//
//  MYGPDFViewController.swift
//  MYGrow
//
//  Created by 小火科技 on 2024/4/1.
//

import UIKit
import PDFKit

class MYGPDFViewController: MYGBaseController {
    
    var pdfUrl:String = ""
    var pdfView = PDFView()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        title = "报告"
        view.backgroundColor = .white
        // 设置PDFView的frame
        view.addSubview(pdfView)
        pdfView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.left.bottom.right.equalToSuperview()
        }
        
        DispatchQueue.global(qos: .userInitiated).async {
            // 从URL获取PDF数据
            guard let pdfURL = URL(string: self.pdfUrl) else { return }
                // 创建PDF文档
                if let pdfDocument = PDFDocument(url: pdfURL) {
                    DispatchQueue.main.async {
                        self.pdfView.document = pdfDocument
                    }

                }
        }
       
    }
   
   
}
